package com.card.gift;

import java.util.Map;

import com.card.main.CardOnline;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import com.xiaoao.net.utils.json.GSONUtils;

/**   
 * @Description: TODO(用一句话描述该文件做什么) 
 * @author siyunlong  
 * @date 2016年8月16日 下午3:22:19 
 * @version V1.0   
 */
public class GiftHelp {
	private static final GiftHelp instance = new GiftHelp();
	public static GiftHelp getInstance() {
		return instance;
	}
	
	public GiftHelp() {
		init();
	}
	
//	private Map<Integer,Gift> giftMap = Maps.newConcurrentMap();
	private ImmutableMap<Integer, Gift> giftMap = null;
	private String giftResouce;
	public void init() {
		Gift g1 = new Gift(CardOnline.Gift_Flower, 0, 0);
		Gift g2 = new Gift(CardOnline.Gift_Ring, 0, 0);
		Gift g3 = new Gift(CardOnline.Gift_Crown, 0, 0);
		giftMap = ImmutableMap.of(g1.getId(), g1, g2.getId(), g2, g3.getId(), g3);
		this.giftResouce = GSONUtils.ToJSONString(giftMap.values());
	}
	
	public Gift getGift(int giftId) {
		return giftMap.get(giftId);
	}

	public String getGiftResouce() {
		return giftResouce;
	}
	
}
